<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateImagenesCamposTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		Schema::create("campos_imagenes", function($table){
			
			$table->increments('id');
			$table->string('url');
			$table->integer("campo_id")->unsigned();
			$table->foreign("campo_id")->references('id')->on('campos')->onDelete('cascade');
			$table->timestamps();
		});
	}
		

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table( 'campos_imagenes', function ($table) {
			$table->dropForeign ( 'campos_imagenes_campo_id_foreign' );
		} );
		
		Schema::dropIfExists("campos_imagenes");
	}

}
